<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

    <script type="text/javascript">

        /**
         * 格式化要素枚举项
         * @param enumerations ：枚举项格式为：0#新增+1#既往+2#删除、1#是+2#否 等等
         * @return 返回满足 EasyUI Combobox 组合框 data 属性的格式，如：[{"id":"1","text":"1 是","children":[]},{"id":"2","text":"2 否","children":[]}]
         */
        function parsingFeatureEnumerations(enumerations) {
            var resultData = [];//返回格式化好的的 json 数组
            //1）如果传入的参数为空，则不做处理
            if (enumerations == null || enumerations == undefined || enumerations.length <= 0) {
                return resultData;
            }
            //2）约定 "+" 分割枚举型
            var enumArray = enumerations.split("+");
            if (enumArray == null || enumArray.length <= 0) {
                return resultData;
            }
            //3）约定以 "#" 分割 编码 与 文本
            for (var i = 0; i < enumArray.length; i++) {
                var enumItem = enumArray[i];
                var valueArray = enumItem.split("#");
                if (valueArray.length == 2) {
                    var code = valueArray[0];
                    var text = valueArray[1];
                    var data = {};
                    data["id"] = code;
                    data["text"] = code + " " + text;
                    data["children"] = [];
                    resultData.push(data);
                }
            }
            return resultData;
        }

        $(function () {
            var enumerations = "1#是+2#否";
            var data = parsingFeatureEnumerations(enumerations);
            console.log(enumerations);
            console.log(data);
            console.log(JSON.stringify(data));
        });
    </script>

</head>
<body>

</body>
</html>